package pl.edu.agh.mguesser.game;

import java.util.*;
import pl.edu.agh.mguesser.playlist.Playlist;
import pl.edu.agh.mguesser.user.User;

/**
 * @author keiran
 */
public class GameSettings {
    
    private Playlist playlist;
    private int rounds;
    private Set<Options> options;
    private List<User> users;

    GameSettings() {
    }

    void setPlaylist(Playlist playlist) {
        if(playlist == null) {
            throw new IllegalArgumentException();
        }
        
        this.playlist = playlist;
    }

    void setRounds(int rounds) {
        if(rounds <= 0) {
            throw new IllegalArgumentException();
        }
        
        this.rounds = rounds;
    }

    void setOptions(Set<Options> options) {
        if(options == null) {
            this.options = EnumSet.noneOf(Options.class);
            
        } else {
            this.options = Collections.unmodifiableSet(EnumSet.copyOf(options));
            
        }
    }

    void setUsers(List<User> users) {
        if(users == null || users.isEmpty()) {
            throw new IllegalArgumentException();
        }
        
        this.users = users;
    }
    
    public Playlist getPlaylist() {
        return playlist;
    }

    public int getRounds() {
        return rounds;
    }

    public Set<Options> getOptions() {
        return options;
    }

    public List<User> getUsers() {
        return users;
    }

}
